import axios from 'axios'
import { get_cache } from "@/util/cache.js"
import { dbIp } from './config.js'
var ip = dbIp

export function login (username,password){
    return axios({
        method: "get",
        url: ip+"/user/login",
        params: { 
            username,
            password
        }
    });
}

// 根据用户token获取用户信息
export function getUserByToken (){
    var token = get_cache("token");
    return axios({
        method: "get",
        url: ip+"/user/getByToken",
        params: { 
            token
        }
    })
}

// 注册用户
// 根据用户token获取用户信息
export function registered(param){
    // var token = get_cache("token");
    return axios({
        method: "get",
        url: ip+"/user/registered",
        params: { 
            ...param
        }
    })
}